package com.aaa.backsystem.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * fileName:SwaggerConfig
 * description:swagger配置文件
 * author:gyc
 * createTime:2020/8/23 18:18
 * version:1.0.0
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.aaa.backsystem.controller"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("接口文档")
                        .description("Swagger生成接口文档")
                        .version("1.0")
                        .contact(new Contact("zwj","www.baidu.com","aaa@163.com"))
                        .license("点这里问百度")
                        .licenseUrl("http://www.baidu.com")
                        .build());
    }
}